package utils

import (
	"crypto/tls"
	gomail "gopkg.in/mail.v2"
	"netdisk/config"
)

func SendSMS(email string, token string) {
	message := gomail.NewMessage()
	message.SetHeader("From", config.FROM)
	message.SetHeader("To", email)
	message.SetHeader("Subject", "注册")
	message.SetBody("text/plain", token)
	dialer := gomail.NewDialer("smtp.qq.com", 465, config.FROM, config.PASSWORD)
	dialer.TLSConfig = &tls.Config{InsecureSkipVerify: true}
	if err := dialer.DialAndSend(message); err != nil {
		panic(err)
	}
}
